home *** CD-ROM | disk | FTP | other *** search
/ ftp.cs.arizona.edu / ftp.cs.arizona.edu.tar / ftp.cs.arizona.edu / icon / newsgrp / group98a.txt / 000003_icon-group-sender _Mon Jan 19 09:31:48 1998.msg < prev    next >
Internet Message Format  |  2000-09-20  |  5KB

  1. Return-Path: <icon-group-sender>
  2. Received: from kingfisher.CS.Arizona.EDU (kingfisher.CS.Arizona.EDU [192.12.69.239])
  3.     by baskerville.CS.Arizona.EDU (8.8.7/8.8.7) with SMTP id JAA24835
  4.     for <icon-group-addresses@baskerville.CS.Arizona.EDU>; Mon, 19 Jan 1998 09:31:48 -0700 (MST)
  5. Received: by kingfisher.CS.Arizona.EDU (5.65v4.0/1.1.8.2/08Nov94-0446PM)
  6.     id AA29406; Mon, 19 Jan 1998 09:31:48 -0700
  7. X-Sender: nevin@pop.interaccess.com (Unverified)
  8. Message-Id: <v04003901b0e8af42376d@[204.148.87.172]>
  9. Mime-Version: 1.0
  10. Content-Type: text/plain; charset="us-ascii"
  11. Date: Mon, 19 Jan 1998 01:52:38 -0600
  12. To: icon-group@optima.CS.Arizona.EDU
  13. From: "Nevin :-] Liber" <nevin@pendragon-software.com>
  14. Subject: Re: Stripping blank and comment lines
  15. Cc: "Gordon Peterson " <gep2@computek.net>
  16. Errors-To: icon-group-errors@optima.CS.Arizona.EDU
  17. Status: RO
  18. Content-Length: 3598
  19.  
  20. "Gordon Peterson " <mailto:gep2@computek.net> writes:
  21. >In a sorted XREF, it's absurd to sort variables principally by their data type
  22. >anyhow.
  23.  
  24. Personally, I don't find alphabetical sort order for variables to be all
  25. that useful; I'd much rather see them in order of declaration (and I always
  26. use local declarations in Icon) or order of use.  And I usually don't have
  27. many variables within a function; if it gets to be a lot, I usually just
  28. declare another function.
  29.  
  30. >If you have a number of variables regarding dates, for example, you'd
  31. >want things like DateP (date pattern), DateMonth, DateYear, DateDay,
  32. >DateWkDay,
  33. >DateLeap, etc to all sort together in the Xref, regardless of that some of
  34. >them
  35. >might be flags, others might be character strings, others might be
  36. >patterns and
  37. >some might be numbers.
  38.  
  39. In your above example, you have no way of telling if DateMonth is a string
  40. or a number.  And in Icon, it matters, as if you were comparing two months,
  41. you'd have to know whether to use "=" or "==".
  42.  
  43. This is the essence of why I personally use this convention for naming my
  44. variables.  While it does in some sense break abstraction, in practical
  45. terms, you need to know what type of object is stored in a variable in
  46. order to manipulate it.
  47.  
  48. >I'm not accusing the poster of originating this claptrap,
  49.  
  50. I think the origin is by Charles Somoyi (sp?) at Microsoft and his
  51. Hungarian notation.  Ironically, I don't use it much in C, as objects are
  52. either numbers (char, int, short, long, enums) or structs/unions.  The way
  53. to manipulate a number in C is the same whether it is an unsigned char or a
  54. long (although the limits of what they can represent are different), and I
  55. can go back to the type declaration for the few times I need to know what
  56. kind of number it is (eg: when writing a printf() statement).  I do use
  57. "Ptr" and "Hdl" as suffixes on variables, since that is usually information
  58. needed to know how to get to the object.
  59.  
  60. I'm just trying to find the right balance between abstraction and the
  61. practical side of having to maniplate the values stored in variables.
  62.  
  63. >but I do think it's
  64. >interesting that so many people, lemming-like, adopt such absurd conventions
  65. >that some obvious loon dreams up and proposes as a naming convention
  66. >"standard".
  67.  
  68. There are reasons behind the convention, even if you don't necessarily
  69. agree with them.  Evem the argument of "because everyone else is doing it"
  70. has some merit, if you have to be sharing your code with other people who
  71. adopt that convention.
  72.  
  73. >It's especially strange in a language like Icon or S*BOL where the type of a
  74. >variable can be QUITE variable during the execution of a program!
  75.  
  76. While that is theoretically true, it rarely occurs in the programs that I
  77. write.  I very rarely use a variable to represent more than one type of
  78. value (&null sometimes being an exception to this rule, although even this
  79. doesn't occur very often).  If I have a different type, I just declare a
  80. different variable.  About the only time it does occur in my code is when I
  81. am taking values out of one of the structure types (tables, lists, sets,
  82. records) or during parameter passing.
  83.  
  84. >Again, please don't take this as a personal attack on the poster
  85.  
  86. No offense taken here.  People ought to think about why they have certain
  87. styles of coding.
  88.  
  89. --
  90.  Nevin ":-)" Liber  <mailto:nevin@pendragon-software.com>  (847) 816-9926
  91.   Senior Software Engineer, Pendragon Software <http://www.webfayre.com/>
  92.  
  93.     Pendragon Software Corporation
  94.     1580 South Milwaukee Avenue, Suite 515
  95.     Libertyville, IL 60048-3776
  96.     voice:    (847) 816-9660
  97.     fax:    (847) 816-9710
  98.  
  99.  
  100.